x86: VCPU structure must reside below 4GB, since it contains embedded
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 28 Jan 2009 17:05:18 +0000 (17:05 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 28 Jan 2009 17:05:18 +0000 (17:05 +0000)
PAE mode PDPTEs.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/arch/x86/domain.c

index 3f8f973b4c719a155a347c8ec7d817afbc34c3a9..1ee5482b96dcafc6ee6c8052d11cd5022f02c6d9 100644 (file)
@@ -165,14 +165,21 @@ void dump_pageframe_info(struct domain *d)
 struct vcpu *alloc_vcpu_struct(void)
 {
     struct vcpu *v;
-    if ( (v = xmalloc(struct vcpu)) != NULL )
+    /*
+     * This structure contains embedded PAE PDPTEs, used when an HVM guest
+     * runs on shadow pagetables outside of 64-bit mode. In this case the CPU
+     * may require that the shadow CR3 points below 4GB, and hence the whole
+     * structure must satisfy this restriction. Thus we specify MEMF_bits(32).
+     */
+    v = alloc_xenheap_pages(get_order_from_bytes(sizeof(*v)), MEMF_bits(32));
+    if ( v != NULL )
         memset(v, 0, sizeof(*v));
     return v;
 }
 
 void free_vcpu_struct(struct vcpu *v)
 {
-    xfree(v);
+    free_xenheap_pages(v, get_order_from_bytes(sizeof(*v)));
 }
 
 #ifdef CONFIG_COMPAT